package example.hellosecurity.example.serviceimpl;

import example.hellosecurity.example.service.MyService;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/**
 * @ClassName
 * @Describtion:
 * @Author:Chenc
 * @Date:2024/1/17 17:16
 * @Version 1.0
 */
public class MyServiceImpl implements MyService {
    @Override
    public Boolean hasPermission(HttpServletRequest httpServletRequest, Authentication authentication) {
        Object principal = authentication.getPrincipal();
        if (principal instanceof UserDetails){
            UserDetails principal1 = (UserDetails) principal;
            Collection<? extends GrantedAuthority> authorities = principal1.getAuthorities();


        }

        return null;
    }
}
